package com.jialiang.exDemo02;

import com.jialiang.exDemo02.common.ErrorCode;
import com.jialiang.exDemo02.common.ResultUtils;
import com.jialiang.exDemo02.exception.ThrowUtils;

public class Demo02Test {
    public static void main(String[] args) {

        // 成功
        ResultUtils.success(new Object());

        // code + message
//        throw new BusinessException(1111,"第一种类");

        // enum.code
//        throw new BusinessException(ErrorCode.NOT_LOGIN_ERROR);

        // enum.code + message
//        throw new BusinessException(ErrorCode.PARAMS_ERROR, "参数为空");



        // 条件成立抛出

        // condition + enum.code
        ThrowUtils.throwIf(true, ErrorCode.OPERATION_ERROR);

        // condition + enum.code + message
        ThrowUtils.throwIf(true, ErrorCode.OPERATION_ERROR,"hahha");

        // condition +runtimeException
        ThrowUtils.throwIf(true, new RuntimeException());

    }
}
